<template>
  <div style="margin-top:30px">
    <el-form ref="form" :rules="rules" :model="form" label-width="80px">
      <el-row>
        <el-col :span="24">
          <div class="grid-content bg-purple">
            <el-form-item label="充值金额" prop="chargeValue" style="margin-right:15px">
              <el-input type="number" v-model="form.chargeValue" placeholder="请输入充值金额"/>
            </el-form-item>
          </div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <div class="grid-content bg-purple">
            <el-form-item label="备注" prop="chargeRemark" style="margin-right:15px">
              <el-input v-model="form.chargeRemark" placeholder="请输入备注"/>
            </el-form-item>
          </div>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="funcCancel">取 消</el-button>
      <el-button type="primary" @click="funcSubmit">确 定</el-button>
    </div>
  </div>
</template>
<script>
  import Vue from 'vue'
  import 'xe-utils'
  import VXETable from 'vxe-table'
  import 'vxe-table/lib/index.css'
  import request from '@/utils/request'

  Vue.use(VXETable)
  export default {
    name: 'partyGroupEdit',
    data() {
      return {
        form: {
          code: '',
          chargeValue: '',
          chargeRemark: '',
        },
        rules: {
          chargeValue: [
            {required: true, message: '请输入充值金额', trigger: 'blur'},
            
          ],
          chargeRemark: [
            {required: true, message: '请输入备注', trigger: 'blur'},
            
          ]
        }
      }
    },
    created() {
    },
    methods: {
      //提交
      init(code){
        this.form = {
          code: code,
          chargeValue: '',
          chargeRemark: '',
        };
      },
      funcSubmit() {
        this.$refs['form'].validate((valid) => {
          if (valid) {
            const data = this.form
            const rLoading = this.openLoading();
            request({url: '/arpa-basic-api/partyGroup/charge', method: 'post', params: data}).then(response => {
              rLoading.close();
              this.$message({message: response.msg, type: 'success'})
              this.$emit('fatherEditMethod')
            }).then(() => this.$refs['form'].resetFields());
          } else {
            return false;
          }
        });
      },
      //取消
      funcCancel() {
        this.$emit('fatherCancelMethod', 'edit')
      }
    }
  }
</script>
<style lang="scss" scoped>
  .dialog-footer {
    margin: 15px 0 15px 0;
    width: 175px;
    float: right;
  }
</style>
